﻿using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Timers;
using Timer = System.Timers.Timer;

namespace StudyTraceListener
{
    class Program
    {
        static void Main(string[] args)
        {
            //using (var stream = File.OpenWrite(@"C:\123.txt"))
            //{
            //    byte[] data = Encoding.UTF32.GetBytes("aaaaaaaaaaa||");
            //    for (int i = 0; i < 10; i++)
            //    {
            //        stream.Write(data, 0, data.Length);
            //    }

            //    //Trace.Listeners.Add(new TextWriterTraceListener(stream));
            //    //for (int i = 0; i < 10; i++)
            //    //{
            //    //    Trace.WriteLine(i + 10);
            //    //}
            //    //Trace.Flush();  //还是刷一下数据才行啊
            //}

            DateTime dateTime = default(DateTime);
            Console.WriteLine(dateTime == DateTime.MinValue);

            Console.WriteLine(Convert.ToDateTime("1990-10-10").ToString());

            Timer tesTimer = new Timer(1000);
            tesTimer.Elapsed += new ElapsedEventHandler(tesTimer_Elapsed);
            tesTimer.Start();

            Console.ReadLine();
        }

        static void tesTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            Thread.Sleep(2000);
            Console.WriteLine(DateTime.Now.ToString());
        }
    }
}
